<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div class="container">
        <!-- v-show -->
        <button @click="flag=!flag">变</button>

        <!-- <p style="width: 100px; height: 100px; background: pink;" v-show="flag">{{ msg }}</p> -->
        <p style="width: 100px; height: 100px; background: pink;" v-if="flag">{{ msg }}</p>


        <!-- v-if、v-else-if、v-else -->
        <p v-if="age>=60">老年</p>
        <p v-else-if="age>=40">中年</p>
        <p v-else-if="age>=18">少年</p>
        <p v-else>童年</p>

        <!-- v-for -->
        <ul>
            <!-- <li v-for="item in names">{{ item }}</li> -->
            <!-- <li v-for="(item,index) in names">{{ index }}-----------{{ item }}</li> -->
            <li v-for="item in num">{{ item }}</li>
        </ul>

        <!-- v-bind -->
        <!-- <img v-bind:src="imgUrl" alt=""> -->
        <img :src="imgUrl" alt="">
    </div>

    <script>
        new Vue({
            el: '.container',
            data: {
                msg: '你好',
                flag: true,
                age: 66,
                names: ['tom', 'jerry', 'lucy', 'lily'],
                num: 5,
                imgUrl: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png'
            }
        })
    </script>
</body>
</html>